{extend name="layout" /}
{block name="content"}
<div class="layui-tab layui-tab-brief">
	<ul class="layui-tab-title">
			<li><a href="{:url('index')}">{$pathCurrent['name']}</a></li>
	    <li><a href="{:url('lcindex',['pid'=>$parent.id])}">流程环节设置</a></li>
	    <li class="layui-this">{empty name="info"}新增{else /}编辑{/empty}流程环节</li>
  	</ul>
</div>
<div class="demoTable" style="margin-top: 25px;margin-left:30px;font-size:18px;font-weight: bold;">
	流程id：
   <div class="layui-inline" style="margin-right:30px;">
	   <!-- <input class="layui-input" name="title" id="title" autocomplete="off"> -->
	   {$parent.id}
   </div>
   <!-- <button class="layui-btn" data-type="reload">搜索</button> -->
   流程编号：
   <div class="layui-inline" style="margin-right:30px;">
	   <!-- <input class="layui-input" name="title" id="title" autocomplete="off"> -->
	   {$parent.detection_sn}
   </div>
   流程名称：
   <div class="layui-inline">
	   <!-- <input class="layui-input" name="title" id="title" autocomplete="off"> -->
	   {$parent.name}
   </div>
</div>
<div class="layui-card-body">
	<form class="layui-form" data-model="form-submit">
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
		  	<legend>基本设置</legend>
		</fieldset>
		<div class="layui-form-item">
			<label class="layui-form-label">环节编号</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" name="d_son_sn" value="{$info['d_son_sn']}">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">环节名称</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" name="name" value="{$info['name']}" datatype="*">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">录入类型</label>
			<div class="layui-input-block">
				<input type="radio" name="type" value="0" title="单次录入" {if condition="$info['type'] eq 0"} checked="" {/if}>
				<input type="radio" name="type" value="1" title="多次录入" {if condition="$info['type'] eq 1"} checked="" {/if}>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">录入人员</label>
			<div class="layui-input-block" id="input_status">
				<input type="radio" name="input_status" value="0" title="全部" 		{if $info['input_status'] eq 0} checked="" {/if}>
				<input type="radio" name="input_status" value="1" title="指定人员" 	{if $info['input_status'] eq 1} checked="" {/if}>
			</div>
		</div>
		
		<div class="layui-form-item" id="input_staff" style="{if $info['input_status']} display:block; {else/} display:none; {/if}">
			<label class="layui-form-label">人员授权</label>
			<input type="hidden" name="input_staff" id="input_staff_val" value={:html_entity_decode($info["input_staff"])}>
			<div class="layui-input-block">
					<div id="test4" class="demo-transfer"></div>
			</div>
		</div>
		


		<div class="layui-form-item">
			<label class="layui-form-label">录入时间</label>
			<div class="layui-input-block">
				<input type="radio" name="time_status" value="0" title="系统时间" {if $info['time_status'] eq 0} checked="" {/if}>
				<input type="radio" name="time_status" value="1" title="手动时间"{if $info['time_status'] eq 1} checked="" {/if}>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">环节描述</label>
			<div class="layui-input-block">
				<textarea id="content" name="content" data-model="form-ueditor" placeholder="">{$info['content']|raw}</textarea>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">排序</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" name="sort" value="{:isset($info['sort']) ? $info['sort'] : '100'}" datatype="*">
				<div class="layui-form-mid layui-word-aux">数字越小越靠前</div>
			</div>
		</div>
		<div class="layui-form-item">
	    	<label class="layui-form-label">状态</label>
	    	<div class="layui-input-block">
	    		{php}$state = isset($info['status']) ? $info['status'] : '1';{/php}
	      		<input type="radio" name="status" value="1" title="启用" {if $state eq 1} checked="" {/if}>
	      		<input type="radio" name="status" value="2" title="冻结" {if $state eq 2} checked="" {/if}>
	    	</div>
	  	</div>
		<div class="layui-form-item">
	    	<div class="layui-input-block">
	    		<input type="hidden" name="id" value="{$info['id']}">
	    		<input type="hidden" name="parent_id" value="{$parent['id']}">
	      		<button class="layui-btn layui-btn-normal">保存</button>
	      		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
	    	</div>
	  	</div>
	</form>
</div>
{/block}
{block name="js"}
<script type="text/javascript" src="/static/lib/assets/data.js"></script>
<script type="text/javascript">
    var mixin = {};
    layui.use(['form','util','layer','transfer'],function(){
		var $ = layui.$
			,transfer = layui.transfer
			,layer = layui.layer
			,util = layui.util;
       

		// var data1 = [
		// 	{"value": "1", "title": "李白"}
		// 	,{"value": "1", "title": "李1白"}
		// 	,{"value": "2", "title": "杜甫"}
		// 	,{"value": "5", "title": "鲁迅", "disabled": true}
		// ]
		var data1 = [
			{foreach name="staff" item="item"}
				{"value": "{$item.id}", "title": "{$item.name}"},
			{/foreach}
		];
		
		//显示搜索框
		transfer.render({
			elem: '#test4'
			,data: data1
			,title: ['未授权员工', '已授权员工']
			{notempty name="$info['input_status']"}
			,value:JSON.parse('{:html_entity_decode($info["input_staff"])}')
			// ,value:JSON.parse('{:html_entity_decode($info["input_staff"])}')
			{/notempty}
			,showSearch: true
			,id:'keyInputStaff'
		})

		
		$.each($('#input_status .layui-form-radio'),function(index){
			$(this).on('click',function(){
				
				if( index == 1 ){
					$('#input_staff').show(300);
				}else{
					$('#input_staff').hide(300);

				}
				
				
			})
		})

		//批量办法定事件
		$('#test4').on('click',function(){
			var getData = transfer.getData('keyInputStaff'); //获取右侧数据
			var arr = [];
			for( i in getData ){
				
				arr.push(getData[i]['value']);
			}
			$('#input_staff_val').val(JSON.stringify(arr));
			
		})

    });
	
	
</script>
{/block}